package com.xzy.shop.dao.impl;

import com.xzy.shop.dao.AddressDao;
import com.xzy.shop.domain.Address;
import com.xzy.shop.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class AddressDaoImpl implements AddressDao {
    JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<Address> findByUid(String uid) {
        String sql = "select * from address where uid = ?";
        return template.query(sql, new BeanPropertyRowMapper<Address>(Address.class), uid);
    }
}
